<template>
	<view class="mb5">
		<scroll-view :scroll-x="true" class="scrollview-box">
			<block v-for="item in scroll_list" :key="item.index">
				<view class="item" @click="gotoProductList(item)">
					<u--image :showLoading="true" :src="item.url" width="204rpx" height="148rpx"></u--image>
				</view>
			</block>
		</scroll-view>
	</view>
</template>

<script>
	import {
		BASE_URL
	} from "@/utils/common.js"
	export default {
		data() {
			return {
				scroll_list: [{
					index: "7",
					url: BASE_URL + "/upload/tab7.png"
				}, {
					index: "0",
					url: BASE_URL + "/upload/tab0.png"
				}, {
					index: "1",
					url: BASE_URL + "/upload/tab1.png"
				}, {
					index: "2",
					url: BASE_URL + "/upload/tab2.png"
				}, {
					index: "3",
					url: BASE_URL + "/upload/tab3.png"
				}, {
					index: "4",
					url: BASE_URL + "/upload/tab4.png"
				}, {
					index: "5",
					url: BASE_URL + "/upload/tab5.png"
				}, {
					index: "6",
					url: BASE_URL + "/upload/tab6.png"
				}],
				//单个宽度
				item_width: '25%'
			}
		},
		props: ['itemData'],
		created() {

		},
		methods: {
			/*跳转页面*/
			gotoProductList(data) {
				if (data.index == 7) {
					uni.navigateTo({
						url: "/subpkg/goods_investmentList/goods_investmentList?index=" + data.index
					});
				} else {
					uni.navigateTo({
						url: "/subpkg/goods_list/goods_list?index=" + data.index
					});
				}
			}
		}
	}
</script>

<style scoped>
	.scrollview-box {
		box-sizing: border-box;
		white-space: nowrap;
		/* 滚动必须加的属性 */
		width: 100%;
		padding: 0rpx 20rpx;
	}

	.item {
		width: 204rpx;
		height: 148rpx;
		margin-right: 28rpx;
		display: inline-flex;
		/* item的外层定义成行内元素才可进行滚动 inline-block / inline-flex 均可 */
		flex-direction: column;
		align-items: center;
		/* background-color: red; */
	}

	.item:last-child {
		margin-right: 0;
	}

	.cover {
		width: 165rpx;
		height: 165rpx;
	}

	.name {
		font-size: 24rpx;
		color: #000000;
		padding: 0;
		width: 90%;
		text-align: center;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}
</style>